﻿using System;
using System.Collections;
using UnityEngine;


public static class MathExtensions
{
    const UInt32 V16 = (1 << 16) - 1;

    public static UInt32 UnorderedPairHash(UInt32 a,UInt32 b)
    {
        /*var ans = a * b;
        ans = (ans << 11) ^ (a ^ b);
        ans = (ans << 11) ^ (a + b);*/
        return a ^ b;
    }
    public static UInt16 left(this UInt32 v)
    {
        return (UInt16)(v >> 16);
    }
    public static UInt16 right(this UInt32 v)
    {
        return (UInt16)(v & V16);
    }
    public static UInt32 combine(this UInt16 v,UInt16 p)
    {
        return (((UInt32)v) << 16) | p;
    }
    public static Vector3 ToDirVector(this float degree)
    {
        return new Vector3(Mathf.Cos(degree/90 * Mathf.PI / 2), Mathf.Sin(degree/90 * Mathf.PI / 2), 0);
    }
  /*  public Vector3 ConvertToWorld(Vector3 pos,Vector3 scale,Vector3 rotate,Vector3 localPos)
    {
        Matrix4x4 matrix = new Matrix4x4 { { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 } };
       
    }*/
}
